﻿///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2008-2009 David Hill. All rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
///////////////////////////////////////////////////////////////////////////////
using System;
using System.Windows.Controls;

using TFSBranchVisualizer.BranchVisualizer.ViewModels;
using TFSBranchVisualizer.BranchVisualizer.Models;
using Infrastructure.TFSServiceClient;

namespace TFSBranchVisualizer.BranchVisualizer.Views
{
    public partial class View1 : UserControl
    {
        public View1(ViewModel1 viewModel)
        {
            InitializeComponent();

            // Set the ViewModel as this View's data context.
            this.DataContext = viewModel;
        }

        private void SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Poor man's implementation of CollectionView functionality -
            // so we can track the currently selected item in the ViewModel.
            ViewModel1 viewModel = this.DataContext as ViewModel1;
            viewModel.SelectedChildBranch = DataItemListBox.SelectedItem as BranchInfo;
        }
    }
}
